package nl.hanze.t23i.gamemodule.game;
 
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.*;
 
public class GameView extends JPanel
{
 
    public GameView(String playerOne, String playerTwo)
    {
        super(new GridLayout(2, 1));
        setVisible(true);
        textArea = new JTextArea(10, 20);
        scrollPane = new JScrollPane(textArea);
        add(scrollPane);
        JPanel panel = new JPanel(new FlowLayout());
        panel.add(new JLabel((new StringBuilder("Player 1: ")).append(playerOne).toString()));
        panel.add(new JLabel((new StringBuilder("Player 2: ")).append(playerTwo).toString()));
        add(panel);
    }
 
    public void addText(String text)
    {
        textArea.append((new StringBuilder(String.valueOf(text))).append("\n").toString());
    }
 
    private static final long serialVersionUID = 0L;
    private JTextArea textArea;
    private JScrollPane scrollPane;
}